const Koa = require('koa')
const router = require('koa-router')() //引入并实例化路由

// 实例化
const app = new Koa()

//路由配置
router.get('/', async (ctx) => {
  ctx.body = '首页'
})
router.get('/news', async (ctx) => {
  ctx.body = '新闻页面' 
})
router.get('/newscontent', async (ctx) => {
  ctx.body = '新闻详情' 
})

//启动路由
app.use(router.routes())
app.use(router.allowedMethods())

app.listen(3000)